package com.regan.erp.model;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import org.apache.poi.ss.formula.functions.T;

import java.util.List;
import java.util.function.Function;

/**
 * 设置菜单父子类
 *
 * @author zhangby
 * @date 2018/10/12 下午12:07
 */
public class MenuNode {
    private Integer id;
    private Integer parent_id;
    private String name;
    private String label;
    private String icon;
    private String href;
    private Integer type;
    private Integer sort;
    private Integer is_show;
    private String permission;
    private List<MenuNode> children = Lists.newArrayList();

    /**
     *  类型转换 Menu -> MenuNode
     */
    public static Function<Menu, MenuNode> convert = menu -> {
        return JSON.parseObject(JSON.toJSONString(menu),MenuNode.class);
    };

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getParent_id() {
        return parent_id;
    }

    public void setParent_id(Integer parent_id) {
        this.parent_id = parent_id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Integer getIs_show() {
        return is_show;
    }

    public void setIs_show(Integer is_show) {
        this.is_show = is_show;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public List<MenuNode> getChildren() {
        return children;
    }

    public void setChildren(List<MenuNode> children) {
        this.children = children;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }
}
